<%--
  Created by IntelliJ IDEA.
  User: LT
  Date: 2018-11-27
  Time: 8:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <jsp:include page="${pageContext.request.contextPath}/common/common.jsp"></jsp:include>
</head>
<body>
<!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));

    //loading区
    myChart.showLoading();
    
    $.post("/house/queryGroupJiaGe",function (data) {
        var data1 = [];
        var data2 = [];
        $.each(data,function (index,item) {
            data1.push(item.sjiage);
            data2.push(item.housejiagecount);
        })
        //隐藏loading
        myChart.hideLoading();
        myChart.setOption({
            xAxis: {
                type: 'category',
                data: data1
            },
            toolbox: {          //图表容器的右上角工具栏
                feature: {
                    dataView: {show: true, readOnly: false},
                    magicType: {show: true, type: ['line', 'bar']},
                    restore: {show: true},
                    saveAsImage: {show: true}
                }
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                data: data2,
                type: 'line'
            }]
        });
    })
    
    
    
    // 指定图表的配置项和数据
    option = {
        xAxis: {
            type: 'category',
            data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        toolbox: {          //图表容器的右上角工具栏
            feature: {
                dataView: {show: true, readOnly: false},
                magicType: {show: true, type: ['line', 'bar']},
                restore: {show: true},
                saveAsImage: {show: true}
            }
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: [820, 932, 901, 934, 1290, 1330, 1320],
            type: 'line'
        }]
    };


    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>
</body>
</html>
